package com.example.x6.configurationmaintenance.Dialog;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TimePicker;
import com.example.x6.configurationmaintenance.Interface.OnMDatePickDialogYesClickListener;
import com.example.x6.configurationmaintenance.R;
import java.text.SimpleDateFormat;

public class MDatePickDialog extends Dialog {
    private final String TAG = getClass().getSimpleName();
    private Switch aSwitch;
    private TimePicker datePicker;
    private int hour = 0;
    private Boolean isOneShot = false;
    private int min = 0;
    private Button no;
    private OnMDatePickDialogYesClickListener onMDatePickDialogYesClickListener;
    private Button yes;

    @RequiresApi(api = 24)
    public MDatePickDialog(@NonNull Context context) {
        super(context);
    }

    /* access modifiers changed from: protected */
    @RequiresApi(api = 23)
    @SuppressLint({"WrongViewCast"})
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.clock_pick);
        this.datePicker = (TimePicker) findViewById(R.id.time_pick);
        this.aSwitch = (Switch) findViewById(R.id.aSwitch);
        this.yes = (Button) findViewById(R.id.yes);
        this.no = (Button) findViewById(R.id.no);
        this.hour = Integer.parseInt(new SimpleDateFormat("HH").format(Long.valueOf(System.currentTimeMillis())));
        this.min = Integer.parseInt(new SimpleDateFormat("mm").format(Long.valueOf(System.currentTimeMillis())));
        initEvent();
    }

    public void setOnMDatePickDialogYesClickListener(OnMDatePickDialogYesClickListener onMDatePickDialogYesClickListener2) {
        this.onMDatePickDialogYesClickListener = onMDatePickDialogYesClickListener2;
    }

    private void initEvent() {
        this.datePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
            /* class com.example.x6.configurationmaintenance.Dialog.MDatePickDialog.AnonymousClass1 */

            public void onTimeChanged(TimePicker timePicker, int i, int i1) {
                MDatePickDialog.this.hour = i;
                MDatePickDialog.this.min = i1;
            }
        });
        this.yes.setOnClickListener(new View.OnClickListener() {
            /* class com.example.x6.configurationmaintenance.Dialog.MDatePickDialog.AnonymousClass2 */

            public void onClick(View view) {
                MDatePickDialog.this.onMDatePickDialogYesClickListener.YesClicked(MDatePickDialog.this.hour, MDatePickDialog.this.min, MDatePickDialog.this.isOneShot.booleanValue());
                MDatePickDialog.this.dismiss();
            }
        });
        this.aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            /* class com.example.x6.configurationmaintenance.Dialog.MDatePickDialog.AnonymousClass3 */

            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                MDatePickDialog.this.isOneShot = Boolean.valueOf(b);
                Log.w(MDatePickDialog.this.TAG, String.valueOf(MDatePickDialog.this.isOneShot));
            }
        });
        this.no.setOnClickListener(new View.OnClickListener() {
            /* class com.example.x6.configurationmaintenance.Dialog.MDatePickDialog.AnonymousClass4 */

            public void onClick(View view) {
                MDatePickDialog.this.dismiss();
            }
        });
    }
}
